import React, { PureComponent } from 'react'
import { Empty } from 'antd'

export default class EmptyData extends PureComponent {
  static defaultProps = {
    type: 'data',
    size: 'md',
    className: '',
    text: ''
  }

  constructor() {
    super()
    this.textObj = {
      data: '暂无数据资料',
      news: '暂无相关内容',
      notice: '暂无消息',
      search: '没有找到符合条件的结果',
      permission: '您暂无权限，请联系客户经理',
      followCmb: '这里一片空白, 快去创建自己的关注组吧'
    }
  }

  render() {
    const { type, size, className, text, fixedHeight } = this.props
    return (
      <div className={`${fixedHeight ? 'fixedEmptyData' : 'commonEmptyData'} ${size} ${className}`}>
        {/* <SvgIcon path={`emptyData/${type}.svg`} /> */}
        <Empty description={<p>{text || this.textObj[type]}</p>} />
        {this.props.children}
      </div>
    )
  }
}
